﻿using System.Configuration.Provider;
using System;
using System.Collections.Generic;
using TSharp.Core.Authentication.Facade;

namespace TSharp.Core.Permissions
{
    public interface IOperation
    {
        /// <summary>
        /// 获取权限值
        /// </summary>
        /// <value>The value.</value>
        int Op { get; }
        /// <summary>
        /// 权限显示名称
        /// </summary>
        /// <value>The title.</value>
        string Title { get; }
    }

    public interface IModule : IPermissionProvider
    {
        /// <summary>
        /// 模块标识
        /// </summary>
        /// <value>The name.</value>
        string Name { get; }
        /// <summary>
        /// 操作值
        /// </summary>
        /// <value>The value.</value>
        int Value { get; }
        IModule Parent { get; }
        IDictionary<string, IModule> Children { get; }
        IDictionary<int, IOperation> All();
    }


    public interface IPermissionProvider
    {
        int GetActValue(IUser user, IModule module);
    }

    public class PAttribute : Attribute 
    {
        public PAttribute(Type moduleType, int actvalue)
        {

        }
    }
}
